<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
 <input  id="c" type="button" value="打开页面">
 <input  id="b" type="button" value="关闭打开的页面">
<script>
    var c = document.getElementById("c");
    var windows;
       c.onclick=function(){
           windows= open("https://www.baidu.com");
       }
         var b = document.getElementById("b");

        b.onclick=function () {
        windows.close();
        }


</script>
</body>
</html>